feat: add implementation of stats/base/dists/wald/skewness#10206
feat: add implementation of stats/base/dists/wald/skewness#10206Planeshifter merged 4 commits intostdlib-js:developfrom
stats/base/dists/wald/skewness#10206Conversation
Signed-off-by: Bhargav Dabhade <bhargava2005dabhade@gmail.com>
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
- task: lint_filenames
status: passed
- task: lint_editorconfig
status: passed
- task: lint_markdown
status: passed
- task: lint_package_json
status: passed
- task: lint_repl_help
status: passed
- task: lint_javascript_src
status: passed
- task: lint_javascript_cli
status: na
- task: lint_javascript_examples
status: passed
- task: lint_javascript_tests
status: passed
- task: lint_javascript_benchmarks
status: passed
- task: lint_python
status: na
- task: lint_r
status: na
- task: lint_c_src
status: missing_dependencies
- task: lint_c_examples
status: missing_dependencies
- task: lint_c_benchmarks
status: missing_dependencies
- task: lint_c_tests_fixtures
status: na
- task: lint_shell
status: na
- task: lint_typescript_declarations
status: passed
- task: lint_typescript_tests
status: passed
- task: lint_license_headers
status: passed
---
Coverage Report
The above coverage report was generated for the changes in this PR. |
|
|
||
| The [skewness][skewness] of a [Wald][wald-distribution] random variable with mean `μ` and shape parameter `λ > 0` is | ||
|
|
||
| <!-- <equation class="equation" label="eq:rayleigh_skewness" align="center" raw="\operatorname{skew}\left( X \right) = 3 \sqrt{\frac{\mu}{\lambda}}" alt="Skewness for a Rayleigh distribution."> --> |
There was a problem hiding this comment.
Looks like there are a couple of copy-paste issues on this line - the equation label says rayleigh_skewness and the alt text says "Rayleigh distribution" instead of Wald.
| <!-- <equation class="equation" label="eq:rayleigh_skewness" align="center" raw="\operatorname{skew}\left( X \right) = 3 \sqrt{\frac{\mu}{\lambda}}" alt="Skewness for a Rayleigh distribution."> --> | |
| <!-- <equation class="equation" label="eq:wald_skewness" align="center" raw="\operatorname{skew}\left( X \right) = 3 \sqrt{\frac{\mu}{\lambda}}" alt="Skewness for a Wald distribution."> --> |
| \mathop{\mathrm{skew}}\left( X \right) = 3 \sqrt{\frac{\mu}{\lambda}} | ||
| ``` | ||
|
|
||
| <!-- <div class="equation" align="center" data-raw-text="\operatorname{skew}\left( X \right) = 3 \sqrt{\frac{\mu}{\lambda}}" data-equation="eq:logistic_skewness"> |
There was a problem hiding this comment.
Same kind of copy-paste issue here - the data-equation references the logistic distribution instead of Wald.
| <!-- <div class="equation" align="center" data-raw-text="\operatorname{skew}\left( X \right) = 3 \sqrt{\frac{\mu}{\lambda}}" data-equation="eq:logistic_skewness"> | |
| <!-- <div class="equation" align="center" data-raw-text="\operatorname{skew}\left( X \right) = 3 \sqrt{\frac{\mu}{\lambda}}" data-equation="eq:wald_skewness"> |
| mu = random_uniform( 0.1, 10.0 ); | ||
| lambda = random_uniform( 0.1, 20.0 ); | ||
| y = stdlib_base_dists_wald_skewness( mu, lambda ); | ||
| printf( "µ: %.4f, λ: %.4f, Mean(X;µ,λ): %.4f\n", mu, lambda, y ); |
There was a problem hiding this comment.
The printf label says "Mean" but this is computing skewness. The README's C example (line 215) has this correct already.
| printf( "µ: %.4f, λ: %.4f, Mean(X;µ,λ): %.4f\n", mu, lambda, y ); | |
| printf( "µ: %.4f, λ: %.4f, Skewness(X;µ,λ): %.4f\n", mu, lambda, y ); |
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
- task: lint_filenames
status: passed
- task: lint_editorconfig
status: passed
- task: lint_markdown
status: passed
- task: lint_package_json
status: na
- task: lint_repl_help
status: na
- task: lint_javascript_src
status: na
- task: lint_javascript_cli
status: na
- task: lint_javascript_examples
status: na
- task: lint_javascript_tests
status: na
- task: lint_javascript_benchmarks
status: na
- task: lint_python
status: na
- task: lint_r
status: na
- task: lint_c_src
status: na
- task: lint_c_examples
status: missing_dependencies
- task: lint_c_benchmarks
status: na
- task: lint_c_tests_fixtures
status: na
- task: lint_shell
status: na
- task: lint_typescript_declarations
status: passed
- task: lint_typescript_tests
status: na
- task: lint_license_headers
status: passed
---
Planeshifter
left a comment
There was a problem hiding this comment.
Getting close, thanks! One more round of feedback.
| double mu; | ||
| double lambda; |
There was a problem hiding this comment.
The variable declarations should be ordered by decreasing character length - lambda before mu. The README's C example (line 206) already has the correct order.
| double mu; | |
| double lambda; | |
| double lambda; | |
| double mu; |
| // MAIN // | ||
|
|
||
| /** | ||
| * Returns the skewness of a Wald distribution with mean `mu` and shape parameter `lambda`. |
There was a problem hiding this comment.
Small consistency nit: main.js uses "Returns the skewness for a Wald distribution" but here it says "of a Wald distribution". The reference wald/mean package uses "for" consistently across both files. Let's match that here.
| * Returns the skewness of a Wald distribution with mean `mu` and shape parameter `lambda`. | |
| * Returns the skewness for a Wald distribution with mean `mu` and shape parameter `lambda`. |
| var mu = uniform( 10, EPS, 10.0, opts ); | ||
| var lambda = uniform( 10, EPS, 20.0, opts ); | ||
|
|
||
| logEachMap( 'µ: %0.4f, λ: %0.4f, Skewness(X;µ,λ): %0.4f', mu, lambda, skewness ); |
There was a problem hiding this comment.
| logEachMap( 'µ: %0.4f, λ: %0.4f, Skewness(X;µ,λ): %0.4f', mu, lambda, skewness ); | |
| logEachMap( 'µ: %0.4f, λ: %0.4f, skew(X;µ,λ): %0.4f', mu, lambda, skewness ); |
| mu = random_uniform( 0.1, 5.0 ); | ||
| lambda = random_uniform( 0.1, 20.0 ); | ||
| y = stdlib_base_dists_wald_skewness( mu, lambda ); | ||
| printf( "µ: %.4f, λ: %.4f, Skewness(X;µ,λ): %.4f\n", mu, lambda, y ); |
There was a problem hiding this comment.
| printf( "µ: %.4f, λ: %.4f, Skewness(X;µ,λ): %.4f\n", mu, lambda, y ); | |
| printf( "µ: %.4f, λ: %.4f, skew(X;µ,λ): %.4f\n", mu, lambda, y ); |
| mu = random_uniform( 0.1, 10.0 ); | ||
| lambda = random_uniform( 0.1, 20.0 ); | ||
| y = stdlib_base_dists_wald_skewness( mu, lambda ); | ||
| printf( "µ: %.4f, λ: %.4f, Skewness(X;µ,λ): %.4f\n", mu, lambda, y ); |
There was a problem hiding this comment.
| printf( "µ: %.4f, λ: %.4f, Skewness(X;µ,λ): %.4f\n", mu, lambda, y ); | |
| printf( "µ: %.4f, λ: %.4f, skew(X;µ,λ): %.4f\n", mu, lambda, y ); |
| var mu = uniform( 10, EPS, 10.0, opts ); | ||
| var lambda = uniform( 10, EPS, 20.0, opts ); | ||
|
|
||
| logEachMap( 'µ: %0.4f, λ: %0.4f, skewness(X;µ,λ): %0.4f', mu, lambda, skewness ); |
There was a problem hiding this comment.
| logEachMap( 'µ: %0.4f, λ: %0.4f, skewness(X;µ,λ): %0.4f', mu, lambda, skewness ); | |
| logEachMap( 'µ: %0.4f, λ: %0.4f, skew(X;µ,λ): %0.4f', mu, lambda, skewness ); |
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
- task: lint_filenames
status: passed
- task: lint_editorconfig
status: passed
- task: lint_markdown
status: passed
- task: lint_package_json
status: na
- task: lint_repl_help
status: na
- task: lint_javascript_src
status: passed
- task: lint_javascript_cli
status: na
- task: lint_javascript_examples
status: passed
- task: lint_javascript_tests
status: na
- task: lint_javascript_benchmarks
status: na
- task: lint_python
status: na
- task: lint_r
status: na
- task: lint_c_src
status: na
- task: lint_c_examples
status: missing_dependencies
- task: lint_c_benchmarks
status: na
- task: lint_c_tests_fixtures
status: na
- task: lint_shell
status: na
- task: lint_typescript_declarations
status: passed
- task: lint_typescript_tests
status: na
- task: lint_license_headers
status: passed
---
|
@Planeshifter I have made the requested changes. Please let me know if there are any further changes to be made |
lib/node_modules/@stdlib/stats/base/dists/wald/skewness/benchmark/c/benchmark.c
Outdated
Show resolved
Hide resolved
lib/node_modules/@stdlib/stats/base/dists/wald/skewness/README.md
Outdated
Show resolved
Hide resolved
lib/node_modules/@stdlib/stats/base/dists/wald/skewness/benchmark/c/benchmark.c
Outdated
Show resolved
Hide resolved
lib/node_modules/@stdlib/stats/base/dists/wald/skewness/benchmark/c/benchmark.c
Outdated
Show resolved
Hide resolved
Signed-off-by: Philipp Burckhardt <pburckhardt@outlook.com>
Planeshifter
left a comment
There was a problem hiding this comment.
Let's get this one in... Thanks!
PR Commit MessagePlease review the above commit message and make any necessary adjustments. |
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes. report:
Progresses #209
Description
This pull request:
Related Issues
This pull request has the following related issues:
Questions
No.
Other
No.
Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
@stdlib-js/reviewers